/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package me.tomato3017.plugins.epicmusic.commands;

import me.tomato3017.plugins.epicmusic.EpicMusic;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

/**
 *
 * @author Anthony Kirksey <Anthony.Kirksey@gmail.com>
 */
public class EpicMusicToggleCE  implements CommandExecutor{
    EpicMusic plugin;

    public EpicMusicToggleCE(EpicMusic plugin) {
        this.plugin = plugin;
    }
    
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if(sender instanceof Player){
            Player player = (Player) sender;
            
            if(EpicMusic.isPlayerDisabled(player)){
                EpicMusic.enablePlayer(player);
                EpicMusic.sendPlayerMessage(player, "EpicMusic enabled!");
                return true;
            }
            else{
                EpicMusic.disablePlayer(player);
                EpicMusic.sendPlayerMessage(player, "EpicMusic disabled!");
                return true;
            }
        }
        
        return false;
    }
    
}
